package com.xxx.fallback;

import com.xxx.domain.Login;
import com.xxx.feignclients.LoginFeignClient;
import com.xxx.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;


@Component
public class LoginFeignClientFallBackFactory implements FallbackFactory<LoginFeignClient> {
    @Override
    public LoginFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return new LoginFeignClient() {
            @Override
            public JSONResult saveOrUpdate(Login login) {
                return JSONResult.error("调用uaa服务的LoginController&saveOrUpdate出错了!");
            }
        };
    }
}
